package com.library.vo;

import com.library.common.utils.DateUtils;
import com.library.domain.AppActivity;
import lombok.Data;

import java.io.Serializable;

/**
 * @Author julyWhj
 * @Description $
 * @Date 2022/3/28 4:24 下午
 **/
@Data
public class AppActivityModel implements Serializable {

    private String activityNo;
    private String activityTitle;
    private String activityCoverImage;
    private String activitySubtitle;
    /**
     * 活动时间
     */
    private String activityTime;
    /**
     * 参与人数
     */
    private String willNum;
    /**
     * 活动详情
     */
    private String activityDetails;

    public static AppActivityModel toModel(AppActivity appActivity) {
        AppActivityModel appActivityModel = new AppActivityModel();
        appActivityModel.setActivityNo(appActivity.getActivityNo());
        appActivityModel.setActivityTitle(appActivity.getActivityTitle());
        appActivityModel.setActivityCoverImage(appActivity.getActivityCoverImage());
        appActivityModel.setActivitySubtitle(appActivity.getActivitySubtitle());
        appActivityModel.setWillNum("参与人数：120");
        appActivityModel.setActivityTime("截止时间：".concat(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, appActivity.getActivityEndTime())));
        return appActivityModel;
    }

    public static AppActivityModel toModelDetails(AppActivity appActivity) {
        AppActivityModel appActivityModel = new AppActivityModel();
        appActivityModel.setActivityNo(appActivity.getActivityNo());
        appActivityModel.setActivityTitle(appActivity.getActivityTitle());
        appActivityModel.setActivityCoverImage(appActivity.getActivityCoverImage());
        appActivityModel.setActivitySubtitle(appActivity.getActivitySubtitle());
        appActivityModel.setActivityTime("截止时间：".concat(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, appActivity.getActivityEndTime())));
        appActivityModel.setActivityDetails(appActivity.getActivityDetails());
        return appActivityModel;
    }
}
